package com.kafka.xiang.common;

import java.awt.*;
import java.awt.event.InputEvent;

public class Mouse {
    Robot robot;

    public Mouse() throws AWTException {
        this.robot = new Robot();
    }

    public void move(int x, int y) {
        System.out.println(x + y);
        robot.mouseMove(x, y); // 移动鼠标到坐标()8
        System.out.println("鼠标移动了" + "(" + x + "," + y + ")");
    }
    public void click(){
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); // 按下左键
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); // 释放左键
        System.out.println("单击了");
    }
    public void doubleClick() {
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); // 按下左键
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); // 释放左键
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); // 按下左键
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); // 释放左键
        System.out.println("双击了");

    }

}
